﻿@using eCollabro.Client.Models.Content;
@using eCollabro.Client.Models.Core;
@using eCollabro.Web.Base;
@using eCollabro.Common
@model BlogCategoryModel
@{
    List<PermissionEnum> userPermissions = (List<PermissionEnum>)ViewBag.UserPermissions;
    bool canEdit = userPermissions.Contains(PermissionEnum.EditContent);
    bool canDelete = userPermissions.Contains(PermissionEnum.DeleteContent);
    bool canAdd = userPermissions.Contains(PermissionEnum.AddContent);
}
@Scripts.Render("~/bundles/blog") 
<div id="placeHolderBlogCategories"></div>
<div id="divBlogCategories" ng-controller="blogCategoriesController" ng-init="initialize('@canAdd','@canEdit','@canDelete')">
    @{
        List<PageButton> pageButtons = new List<PageButton>();
        pageButtons.Add(new PageButton { Id = "btnRefresh", CssClass="btn btn-warning", ButtonText = "Refresh", Icon = "refresh", Method = "loadBlogCategories()" });
        if (canAdd)
        {
            pageButtons.Add(new PageButton { Id = "btnAdd", CssClass="btn btn-success", ButtonText = "Add Blog Category", Icon = "plus", Method = "openBlogCategory(0)" });
        }
    }
    @Html.Partial("_PageHeader", new PageHeaderModel { ViewId = "BlogCategories", PageTitle = "Blog Categories", PageButtons = pageButtons })
    <table style="width:100%" class="table table-striped table-bordered" id="tblBlogCategories" cellspacing="0">
        <thead>
            <tr>
                @if (canAdd || canEdit || canDelete) // Contributor
                {
                    <th>Id #</th>
                    <th style="width:350px">Category</th>
                    <th>Active</th>
                    <th>Action</th>
                }
                else
                {
                    <th style="width:80%">Category</th>
                    <th>Action</th>
                }
            </tr>
        </thead>
    </table>
</div>
